<!--
  ~ CopyRight (c) 2021 ShaoxiongDu<shaoxiongdu.dev@gmail.com>  All Rights Reserved
  -->

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>


  <div id="app">
    <h2>父组件</h2>
    <h2>{{message}}</h2>
    <hr>
    <!--传入插槽-->
    <cpn><button>123</button></cpn>

    <!--不传插槽显示默认值-->
    <cpn></cpn>
  </div>

  <template id="cpn">
    <div>
      <h2>子组件</h2>
      <!--插槽展位-->
      <slot><button>2q13</button></slot>
    </div>

  </template>
<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<script>
  const app = new Vue({
    el: "#app",
    data: {
      message: "Hello World!"
    },
    components: {
      cpn:{
        template: '#cpn'
      }
    }
  })

</script>




</body>
</html>